
var express = require('express')
const nodemon = require('nodemon')
var {expressjwt}=require('express-jwt')
// 创建一web服务器
var app = express()
//express.static() express内置的静态资源托管的中间件
app.use(express.static("static"))
// 验证token
app.use(expressjwt({secret:'1234',algorithms:['HS256']}).unless({path:['/user/register','/user/login']}))
// 处理post请求参数的中间件
app.use(express.json())
app.use(express.urlencoded({ extended: false }))


// 导入userRouter包
var userRouter = require('./router/userRouter')
app.use('/user', userRouter)

// 启动web服务器，调用
app.listen(8080)
